﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharedLib.XmlDataModel;
using SharedLib.DataStructure;

namespace Tracy.DataModel.UltraExplorer
{
    public interface IClassifier<T> : IPlugin where T : XmlDataModelWithAttributesAndID, new()
    {
        /// <summary>
        /// Get the matching categories of current item
        /// </summary>
        /// <param name="items"></param>
        /// <returns></returns>
        Dictionary<string, List<T>> FindCategories(List<T> items);

        /// <summary>
        /// Get the name of the category key (e.g. Entry ID to Entry Name)
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        string GetCategoryName(string key);

        /// <summary>
        /// Get the matching items for a given category key from the given item list
        /// </summary>
        /// <param name="items"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        List<T> GetItems(List<T> items, string key);

        /// <summary>
        /// Whether the item is matching the category
        /// </summary>
        /// <param name="item">Item</param>
        /// <param name="key">Key of the category</param>
        /// <returns></returns>
        bool MatchCategory(T item, string key);

        /// <summary>
        /// Optional parameter for classifier use
        /// </summary>
        string Parameter { get; set; }
    }
}
